package com.yc.cloud.log.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yc.cloud.common.config.FeignConfig;
import com.yc.cloud.common.model.response.Outcome;
import com.yc.cloud.log.fallback.LogClientFallback;
import com.yc.cloud.log.model.DataLog;
import com.yc.cloud.log.model.SaveDataLog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Map;

/**
 * @author 杨智杰
 * @date 2021/8/12 9:28
 */
@FeignClient(value = "log-api", contextId = "log-feign", path = "/log",
        fallback = LogClientFallback.class, configuration = FeignConfig.class)
public interface LogClient {

    @PostMapping("/data/setCaChe")
    void setCaChe(@RequestBody @Valid SaveDataLog param);

    /**
     * 分页查询
     *
     * @param param
     * @return
     */
    @GetMapping("/data")
    Outcome<Page<DataLog>> page(@RequestParam Map<String, Object> param);

}
